package com.hg.distributedlock.redis;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: skh
 * @Date: 2019/10/14 10:01
 * @Description:
 */
@RestController
public class ActivityController {

    @Autowired
    private ActivityService activityService;

    @GetMapping("/getRedPacket")
    public String getRedPacket() {
        //抢红包:一个人只能抢一个红包
        Integer userId = 1000;
        //activityService.getRedPacket(1000);
        activityService.getRedPacketV3(1000);
        return "success";
    }

    @GetMapping("/emptyTable")
    public String emptyTable() {
        //清空表
        activityService.emptyTable();
        return "success";
    }
}
